package com.cn.ycy.entity;


import com.cn.ycy.exception.code.ErrorCode;

public enum BusinessErrorCodeEnums implements ErrorCode {
    /**
     * 暂定
     * 700-999 系统级别或者通用异常
     */

    GW_UNKNOWN_ERROR(600, "网关服务异常"),
    SVC_RESPONSE_TIMEOUT(601, "服务响应超过网关超时设置"),

    CALLBACK_CHECK(701, "Callback校验不通过"),
    CANNOT_GET_SIGN(702, "获取签名失败"),

    WHITE_API_NOT_MATCH(801, "请求的服务没有开放该api"),
    BLACK_IP_LIST(802, "访问IP受限"),

    WHITE_API_METHOD_NOT_MATCH(901, "请求类型不匹配"),
    REQUEST_URI_NOT_MATCH(902, "请求服务地址不匹配"),
    REQUEST_REFERER_NOT_MATCH(903, "请求域不匹配"),
    ROUTE_NOT_FIND(904, "网关没有要访问的信息"),

    ORDER_QUOTA_EXHAUSTED(1001, "订单访问次数已经使用完");


    private final int code;
    private final String desc;

    BusinessErrorCodeEnums(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getDesc() {
        return this.desc;
    }

    @Override
    public String toString() {
        return String.format("Code:[%s], Description:[%s]. ", this.code, this.desc);
    }

}
